﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="DropDownListBindable_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="ObjectDataSource1" onrowdatabound="GridView1_RowDataBound">
            <Columns>
                <asp:CommandField ShowEditButton="True" ShowSelectButton="True" />
                <asp:BoundField DataField="SId" HeaderText="SId" SortExpression="SId" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:TemplateField HeaderText="Nullable" SortExpression="Nullable">
                    <EditItemTemplate>
                        <asp:DropDownList ID="DropDownList1" 
                            runat="server" Width="80px"
                            SelectedValue='<%# Bind("Nullable") %>' 
                            DataSourceID="ObjectDataSource2" DataTextField="Value" 
                            DataValueField="Key" ondatabound="DropDownList1_DataBound">
                            <asp:ListItem></asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("Nullable") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            DataObjectTypeName="SampleODS+Sample" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="ListSamples" 
            TypeName="SampleODS" UpdateMethod="UpdateSample"></asp:ObjectDataSource>
    </div>

    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="ListDropDown" 
        TypeName="SampleODS" onselected="ObjectDataSource2_Selected"></asp:ObjectDataSource>

    </form>
</body>
</html>
